package com.ncd.disease.domain;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ncd.common.annotation.Excel;
import lombok.Data;

import java.util.Date;

/**
 * 患者基本信息对象 ret_patient
 * 
 * @author zhouxin
 * @date 2024-03-07
 */
@Data
@TableName(value = "ret_patient")
public class RetPatient
{
    private static final long serialVersionUID = 1L;


    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    /** 登记号 */
    @Excel(name = "登记号")
    private String patNo;

    /** 患者姓名 */
    @Excel(name = "患者姓名")
    private String patName;

    /** 性别 */
    @Excel(name = "性别")
    private String patSex;

    /** 生日 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
    private Date patBirth;

    /** 职业 */
    @Excel(name = "职业")
    private String patCareer;

    /** 婚姻 */
    @Excel(name = "婚姻")
    private String patMarriage;

    /** 民族 */
    @Excel(name = "民族")
    private String patNation;

    /** 户籍 */
    @Excel(name = "户籍")
    private String patDomicile;

    /** 学历 */
    @Excel(name = "学历")
    private String patEducation;

    /** 医保类型 */
    @Excel(name = "医保类型")
    private String patInsu;

    /** 身高 */
    @Excel(name = "身高")
    private String patHeight;

    /** 体重 */
    @Excel(name = "体重")
    private String patWeight;

    /** 地址 */
    @Excel(name = "地址")
    private String patAddress;

    /** 身份证 */
    @Excel(name = "身份证")
    private String patIdCard;

    /** 电话 */
    @Excel(name = "电话")
    private String patTel;

    /** 联系人 */
    @Excel(name = "联系人")
    private String patContact;

    /** 联系人电话 */
    @Excel(name = "联系人电话")
    private String patContactTel;

    /** 诊断 */
    @Excel(name = "诊断")
    private String patDiagnosis;

    /** 主诉 */
    @Excel(name = "主诉")
    private String patChiefComplaint;

    /** 首诊医师 */
    @Excel(name = "首诊医师")
    private String patDoctor;

    @TableField(exist = false)
    private String patAge;

    public String getPatAge() {
        if(ObjectUtil.isNotNull(patBirth)){
            try{
                return DateUtil.ageOfNow(patBirth)+"";
            }catch (Exception e){
                return "";
            }
        }
        return "";
    }

    @TableField(exist = false)
    private Long patiDiaId;

    @TableField(exist = false)
    private String patiAdmType;
}
